package com.fanrenqiji.entity;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.Where;

import javax.persistence.*;

/**
 * Created by yanwt on 2017/3/16.
 */
@Getter
@Setter
@Entity
@Table(name="tb_company_info")
@org.hibernate.annotations.Table(appliesTo = "tb_company_info",comment = "公司信息")
@org.hibernate.annotations.DynamicInsert
@org.hibernate.annotations.DynamicUpdate
@org.hibernate.annotations.Cache(region="company_info", usage = CacheConcurrencyStrategy.READ_WRITE)
public class CompanyInfoEntity extends DataEntity{

    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Long id;

    @ManyToOne(fetch = FetchType.LAZY,optional = false)
    @JoinColumn(name = "company_id", insertable = false, updatable = false, columnDefinition = ("bigint(20) default null comment '公司ID'"))//,foreignKey = @ForeignKey(value=ConstraintMode.NO_CONSTRAINT))
    @Where(clause = "del_flag=" + DEL_FLAG_NORMAL)
    private OfficeEntity office;

    @Column(name = "company_id", columnDefinition = ("bigint(20) not null comment '公司ID'"))
    private Long companyId;

    @Column(name="company_name",columnDefinition="varchar(200) not null comment '公司名称'")
    private String companyName;

    @Column(name="bank_account_no",columnDefinition="varchar(50) not null comment '银行账号'")
    private String bankAccountNo;

    @Column(name="bank_account_name",columnDefinition="varchar(200) not null comment '开户行'")
    private String bankAccountName;

    @Column(name="legal_person",columnDefinition="varchar(200) not null comment '公司法人'")
    private String legalPerson;

    @Column(name="address",columnDefinition="varchar(255) not null comment '地址'")
    private String address;

    @Column(name="contact_number",columnDefinition="varchar(50) not null comment '联系电话'")
    private String contactNumber;

}
